package com.log.controller;

import com.log.common.vo.ResultVo;
import com.log.pojo.LogGoodsOutIn;
import com.log.pojoVo.LogGoodsListVo;
import com.log.service.LogGoodsInService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wjy
 * @create 2023-10-2023/10/16 15:35
 */
@RestController
@RequestMapping("/goodsin")
@Api(tags = "出入库管理",value = "")
public class LogGoodsInController {
    @Autowired
    private LogGoodsInService logGoodsInService;
    @ApiOperation("添加出库单")
    @PostMapping("/insertloggoodsout")
    public ResultVo insertgoodsout(@RequestBody LogGoodsListVo listVo){
        return logGoodsInService.insertLogGoodsOutIn(listVo);
    }
    @ApiOperation("通过ID查询单条记录")
    @GetMapping("/{id}")
    public ResultVo getById(@PathVariable("id") int id){

        return  logGoodsInService.getLogGoodsInById(id);
    }
    @ApiOperation("分页查询接口")
    @GetMapping("/page")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(dataType = "int",name = "pageNum",value = "当前的页码",required = true),
                    @ApiImplicitParam(dataType = "int",name = "limit",value = "每页显示条数",required = true),

            }
    )
    public ResultVo listPage(int pageNum,int limit){
        return logGoodsInService.getLogGoodsInByPage(pageNum,limit);
    }

    @ApiOperation("确认入库接口")
    @GetMapping("/confirmGoodsIn")
    public ResultVo confirmGoodsIn(int id){
        return logGoodsInService.confirmLogGoodsIn(id);
    }
    @ApiOperation("查询入库单的明细详细")
    @GetMapping("id")
    public ResultVo getDetailById(int id)
    {
        return logGoodsInService.getLogGoodsInDetails(id);
    }

    @ApiOperation("分页查询指定仓库入库信息")
    @GetMapping("/getCurrentLogGoodsInByPage")
    public ResultVo getCurrentLogGoodsInByPage(int pageNum,int limit,String log_goods_out_to_depot)
    {
        return logGoodsInService.getCurrentLogGoodsInByPage(pageNum,limit,log_goods_out_to_depot);
    }

    @ApiOperation("分页查询指定仓库的入库指定状态信息")
    @GetMapping("/getCurrentNoLogGoodsInByPage")
    public ResultVo getCurrenNotLogGoodsInByPage(int pageNum,int limit,String log_goods_out_to_depot,int status)
    {
        return logGoodsInService.getCurrentNoLogGoodsInByPage(pageNum,limit,log_goods_out_to_depot,status);
    }
}
